<?php

namespace app\admin\controller\carbon\campus;

use app\common\controller\Backend;

/**
 * 学校列管理
 *
 * @icon fa fa-circle-o
 */
class School extends Backend
{

    /**
     * School模型对象
     * @var \app\admin\model\carbon\campus\School
     */
    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\admin\model\carbon\campus\School;
        $this->view->assign("statusList", $this->model->getStatusList());
    }




    /**
     * 查看
     */
    public function index()
    {
        $this->request->filter(['strip_tags']);
        if ($this->request->isAjax()) {
            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
            $list = $this->model
                ->where($where)
                ->order($sort, $order)
                ->order('id', 'ASC')
                ->paginate($limit);

            $result = array("total" => $list->total(), "rows" => $list->items());

            return json($result);
        }
        return $this->view->fetch();
    }
}
